﻿using Prism.DryIoc;
using Prism.Ioc;
using Prism.Regions;
using PrismStudy;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace PrismRegionSimple
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : PrismApplication
    {
        protected override Window CreateShell()
        {
            return Container.Resolve<MainWindow>();
        }

        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {
            // 绑定注册View和ViewModel,将MainWindow和MainViewModel绑定起来,并进行注册
            containerRegistry.RegisterForNavigation<MainWindow, MainViewModel>();
        }

        protected override void ConfigureRegionAdapterMappings(RegionAdapterMappings regionAdapterMappings)
        {
            base.ConfigureRegionAdapterMappings(regionAdapterMappings);
            // 将控件和其对应的适配器进行绑定注册
            regionAdapterMappings.RegisterMapping<StackPanel, StackPanelRegionAdapter>();
        }
    }
}
